#pragma once

#include "utils.h"
#include "Camera.h"


class OrdinaryCamera : public Camera
{
private:
    VideoCapture cam;
    Mat img;
public:
    OrdinaryCamera(string camera_name);
    ~OrdinaryCamera();

    int open();

    int close(){}
    Mat getFrame();
};

OrdinaryCamera::OrdinaryCamera(string camera_name):Camera(camera_name)
{
    this->device_id = camera_name;
    this->is_opened = false;
}

OrdinaryCamera::~OrdinaryCamera()
{
    cam.release();
}

inline
int OrdinaryCamera::open()
{
    cam.open(cam_name);
    this->is_opened = cam.isOpened();
    return 0;
}

inline
Mat OrdinaryCamera::getFrame()
{
    cam >> img;
    return img.clone();
}
